/*     */ package com.zimbra.cs.ldap.unboundid;
/*     */ 
/*     */ import com.zimbra.common.localconfig.KnownKey;
/*     */ import com.zimbra.common.localconfig.LC;
/*     */ import java.io.File;
/*     */ import java.io.IOException;
/*     */ import java.io.InputStream;
/*     */ import java.io.OutputStream;
/*     */ import java.net.InetAddress;
/*     */ import java.net.Socket;
/*     */ import java.net.SocketAddress;
/*     */ import java.net.SocketException;
/*     */ import java.net.UnknownHostException;
/*     */ import java.nio.channels.SocketChannel;
/*     */ import javax.net.SocketFactory;
/*     */ import org.newsclub.net.unix.AFUNIXSocket;
/*     */ import org.newsclub.net.unix.AFUNIXSocketAddress;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class UnixDomainSocketFactory
/*     */   extends SocketFactory
/*     */ {
/*     */   public Socket createSocket(String address, int port)
/*     */     throws IOException, UnknownHostException
/*     */   {
/*  45 */     return new UnixDomainSocket(null);
/*     */   }
/*     */   
/*     */   public Socket createSocket(InetAddress address, int port) throws IOException
/*     */   {
/*  50 */     throw new UnsupportedOperationException();
/*     */   }
/*     */   
/*     */   public Socket createSocket(String address, int port, InetAddress localAddress, int localPort)
/*     */     throws IOException, UnknownHostException
/*     */   {
/*  56 */     throw new UnsupportedOperationException();
/*     */   }
/*     */   
/*     */   public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
/*     */     throws IOException
/*     */   {
/*  62 */     throw new UnsupportedOperationException();
/*     */   }
/*     */   
/*     */   private static class UnixDomainSocket
/*     */     extends Socket
/*     */   {
/*  68 */     private static final String LDAPI_SOCKET_FILE = LC.ldap_ldapi_socket_file.value();
/*     */     
/*     */     private AFUNIXSocket socket;
/*     */     
/*     */     private UnixDomainSocket()
/*     */       throws IOException
/*     */     {
/*  75 */       this.socket = AFUNIXSocket.newInstance();
/*  76 */       AFUNIXSocketAddress endpoint = new AFUNIXSocketAddress(new File(LDAPI_SOCKET_FILE));
/*  77 */       this.socket.connect(endpoint);
/*     */     }
/*     */     
/*     */     public void bind(SocketAddress bindpoint) throws IOException
/*     */     {
/*  82 */       this.socket.bind(bindpoint);
/*     */     }
/*     */     
/*     */     public void close() throws IOException
/*     */     {
/*  87 */       this.socket.close();
/*     */     }
/*     */     
/*     */     public void connect(SocketAddress endpoint) throws IOException
/*     */     {
/*  92 */       this.socket.connect(endpoint);
/*     */     }
/*     */     
/*     */     public void connect(SocketAddress endpoint, int timeout) throws IOException
/*     */     {
/*  97 */       this.socket.connect(endpoint, timeout);
/*     */     }
/*     */     
/*     */     public SocketChannel getChannel()
/*     */     {
/* 102 */       return this.socket.getChannel();
/*     */     }
/*     */     
/*     */     public InetAddress getInetAddress()
/*     */     {
/* 107 */       return this.socket.getInetAddress();
/*     */     }
/*     */     
/*     */     public InputStream getInputStream() throws IOException
/*     */     {
/* 112 */       return this.socket.getInputStream();
/*     */     }
/*     */     
/*     */     public boolean getKeepAlive() throws SocketException
/*     */     {
/* 117 */       return this.socket.getKeepAlive();
/*     */     }
/*     */     
/*     */     public InetAddress getLocalAddress()
/*     */     {
/* 122 */       return this.socket.getLocalAddress();
/*     */     }
/*     */     
/*     */     public int getLocalPort()
/*     */     {
/* 127 */       return this.socket.getLocalPort();
/*     */     }
/*     */     
/*     */     public SocketAddress getLocalSocketAddress()
/*     */     {
/* 132 */       return this.socket.getLocalSocketAddress();
/*     */     }
/*     */     
/*     */     public boolean getOOBInline() throws SocketException
/*     */     {
/* 137 */       return this.socket.getOOBInline();
/*     */     }
/*     */     
/*     */     public OutputStream getOutputStream() throws IOException
/*     */     {
/* 142 */       return this.socket.getOutputStream();
/*     */     }
/*     */     
/*     */     public int getPort()
/*     */     {
/* 147 */       return this.socket.getPort();
/*     */     }
/*     */     
/*     */     public int getReceiveBufferSize() throws SocketException
/*     */     {
/* 152 */       return this.socket.getReceiveBufferSize();
/*     */     }
/*     */     
/*     */     public SocketAddress getRemoteSocketAddress()
/*     */     {
/* 157 */       return this.socket.getRemoteSocketAddress();
/*     */     }
/*     */     
/*     */     public boolean getReuseAddress() throws SocketException
/*     */     {
/* 162 */       return this.socket.getReuseAddress();
/*     */     }
/*     */     
/*     */     public int getSendBufferSize() throws SocketException
/*     */     {
/* 167 */       return this.socket.getSendBufferSize();
/*     */     }
/*     */     
/*     */     public int getSoLinger() throws SocketException
/*     */     {
/* 172 */       return this.socket.getSoLinger();
/*     */     }
/*     */     
/*     */     public int getSoTimeout() throws SocketException
/*     */     {
/* 177 */       return this.socket.getSoTimeout();
/*     */     }
/*     */     
/*     */     public boolean getTcpNoDelay() throws SocketException
/*     */     {
/* 182 */       return this.socket.getTcpNoDelay();
/*     */     }
/*     */     
/*     */     public int getTrafficClass() throws SocketException
/*     */     {
/* 187 */       return this.socket.getTrafficClass();
/*     */     }
/*     */     
/*     */     public boolean isBound()
/*     */     {
/* 192 */       return this.socket.isBound();
/*     */     }
/*     */     
/*     */     public boolean isClosed()
/*     */     {
/* 197 */       return this.socket.isClosed();
/*     */     }
/*     */     
/*     */     public boolean isConnected()
/*     */     {
/* 202 */       return this.socket.isConnected();
/*     */     }
/*     */     
/*     */     public boolean isInputShutdown()
/*     */     {
/* 207 */       return this.socket.isInputShutdown();
/*     */     }
/*     */     
/*     */     public boolean isOutputShutdown()
/*     */     {
/* 212 */       return this.socket.isOutputShutdown();
/*     */     }
/*     */     
/*     */     public void sendUrgentData(int data) throws IOException
/*     */     {
/* 217 */       this.socket.sendUrgentData(data);
/*     */     }
/*     */     
/*     */     public void setKeepAlive(boolean on) throws SocketException
/*     */     {
/* 222 */       this.socket.setKeepAlive(on);
/*     */     }
/*     */     
/*     */     public void setOOBInline(boolean on) throws SocketException
/*     */     {
/* 227 */       this.socket.setOOBInline(on);
/*     */     }
/*     */     
/*     */     public void setPerformancePreferences(int connectionTime, int latency, int bandwidth)
/*     */     {
/* 232 */       this.socket.setPerformancePreferences(connectionTime, latency, bandwidth);
/*     */     }
/*     */     
/*     */     public void setReceiveBufferSize(int size) throws SocketException
/*     */     {
/* 237 */       this.socket.setReceiveBufferSize(size);
/*     */     }
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     public void setReuseAddress(boolean on)
/*     */       throws SocketException
/*     */     {}
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */     public void setSendBufferSize(int size)
/*     */       throws SocketException
/*     */     {
/* 254 */       this.socket.setSendBufferSize(size);
/*     */     }
/*     */     
/*     */     public void setSoLinger(boolean on, int linger) throws SocketException
/*     */     {
/* 259 */       this.socket.setSoLinger(on, linger);
/*     */     }
/*     */     
/*     */     public void setSoTimeout(int timeout) throws SocketException
/*     */     {
/* 264 */       this.socket.setSoTimeout(timeout);
/*     */     }
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */     public void setTcpNoDelay(boolean on)
/*     */       throws SocketException
/*     */     {}
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */     public void setTrafficClass(int tc)
/*     */       throws SocketException
/*     */     {
/* 281 */       this.socket.setTrafficClass(tc);
/*     */     }
/*     */     
/*     */     public void shutdownInput() throws IOException
/*     */     {
/* 286 */       this.socket.shutdownInput();
/*     */     }
/*     */     
/*     */     public void shutdownOutput() throws IOException
/*     */     {
/* 291 */       this.socket.shutdownOutput();
/*     */     }
/*     */     
/*     */     public String toString()
/*     */     {
/* 296 */       return this.socket.toString();
/*     */     }
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/ldap/unboundid/UnixDomainSocketFactory.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */